<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="100px"
    >
      <el-form-item label="MIS采购编码" prop="purchaseDocumentCode">
        <el-input
          v-model="queryParams.purchaseDocumentCode"
          placeholder="请输入MIS采购编码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="采购单号" prop="purchaseOrderNumber">
        <el-input
          v-model="queryParams.purchaseOrderNumber"
          placeholder="请输入采购单号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="合同号" prop="contractNumber">
        <el-input
          v-model="queryParams.contractNumber"
          placeholder="请输入合同号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="匹配状态" prop="allocationStatus">
        <el-select
          v-model="queryParams.matchStatus"
          placeholder="匹配状态"
          clearable
        >
          <el-option
            v-for="dict in dict.type.sys_match_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
        <el-button
          :icon="!isOpen ? 'el-icon-arrow-down' : 'el-icon-arrow-up'"
          size="mini"
          @click="shouqi"
          >展开/收起</el-button
        >
      </el-form-item>
      <div v-if="isOpen">
        <el-form-item label="数据异常" prop="dataAnomaly">
          <el-input
            v-model="queryParams.dataAnomaly"
            placeholder="请输入数据异常"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="采购日期" prop="purchaseDate">
          <el-date-picker
            clearable
            v-model="queryParams.purchaseDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择采购日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="品牌" prop="brand">
          <el-input
            v-model="queryParams.brand"
            placeholder="请输入品牌"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="渠道" prop="channel">
          <el-input
            v-model="queryParams.channel"
            placeholder="请输入渠道"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="店铺" prop="storeName">
          <el-input
            v-model="queryParams.storeName"
            placeholder="请输入店铺"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="款式数量" prop="styleCount">
          <el-input
            v-model="queryParams.styleCount"
            placeholder="请输入款式数量"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="skc数量" prop="skcCount">
          <el-input
            v-model="queryParams.skcCount"
            placeholder="请输入skc数量"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="sku数量" prop="skuCount">
          <el-input
            v-model="queryParams.skuCount"
            placeholder="请输入sku数量"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="采购金额" prop="purchaseAmount">
          <el-input
            v-model="queryParams.purchaseAmount"
            placeholder="请输入采购金额"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="分货状态" prop="货分状态">
          <el-input
            v-model="queryParams.货分状态"
            placeholder="请输入分货状态"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
      </div>
      <!-- <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item> -->
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['productAllocation:poRelation:add']"
          >新增</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['productAllocation:poRelation:edit']"
          >修改</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['productAllocation:poRelation:remove']"
          >删除</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['productAllocation:poRelation:export']"
          >导出</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button plain size="mini" @click="handlecheckMatch"
          >匹配检测</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button plain size="mini" @click="handlesyncChannelSubmissionData"
          >同步数据</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          plain
          size="mini"
          v-hasPermi="[
            'productAllocation:poRelation:checkChannelOrderWareHouseBinding',
          ]"
          @click="handlecheckChannelOrderWareHouseBinding"
          >仓库配置检测</el-button
        >
      </el-col>
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>

    <el-table
      v-loading="loading"
      :data="poRelationList"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="id" align="center" prop="id" />
      <el-table-column
        width="180"
        label="MIS采购编码"
        align="center"
        prop="purchaseDocumentCode"
      >
        <template slot-scope="scope">
          <span
            style="
              color: rgb(37, 137, 255);
              cursor: pointer;
              text-decoration: underline;
              font-weight: bold;
            "
            @click="selectformisNew(scope.row)"
          >
            {{ scope.row.purchaseDocumentCode }}
          </span>
        </template>
      </el-table-column>
      <el-table-column
        label="采购单号"
        align="center"
        prop="purchaseOrderNumber"
      >
        <template slot-scope="scope">
          <span
            style="
              color: rgb(37, 137, 255);
              cursor: pointer;
              text-decoration: underline;
              font-weight: bold;
            "
            @click="selectpurchaseOrderNumber(scope.row)"
          >
            {{ scope.row.purchaseOrderNumber }}
          </span>
        </template>
      </el-table-column>
      <el-table-column label="匹配状态" align="center" prop="matchStatus">
        <template slot-scope="scope">
          <span @click="handleMatchInfo(scope.row)">
            <dict-tag
              :options="dict.type.sys_match_status"
              :value="scope.row.matchStatus"
            />
          </span>
        </template>
      </el-table-column>
      <el-table-column
        width="110"
        label="仓库配置"
        align="center"
        prop="warehouseConfigured"
      >
        <template slot-scope="scope">
          <span @click="handlewarehouseConfigured(scope.row)">
            <dict-tag
              :options="dict.type.sys_warehouse_pass"
              :value="scope.row.warehouseConfigured"
            />
          </span>
        </template>
      </el-table-column>
      <el-table-column label="合同号" align="center" prop="contractNumber" />
      <el-table-column label="数据异常" align="center" prop="dataAnomaly" />
      <el-table-column label="采购日期" align="center" prop="purchaseDate">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.purchaseDate, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="品牌" align="center" prop="brand" />
      <el-table-column label="渠道" align="center" prop="channel" />
      <el-table-column label="店铺" align="center" prop="storeName" />
      <el-table-column label="款式数量" align="center" prop="styleCount" />
      <el-table-column label="skc数量" align="center" prop="skcCount" />
      <el-table-column label="sku数量" align="center" prop="skuCount" />
      <el-table-column label="采购金额" align="center" prop="purchaseAmount" />
      <el-table-column label="到货状态" align="center" prop="shippedStatus" />
      <el-table-column label="分货状态" align="center" prop="货分状态" />
      <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['productAllocation:poRelation:edit']"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['productAllocation:poRelation:remove']"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改渠道提报和采购单关系对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form
        ref="form"
        :model="form"
        :rules="rules"
        label-width="110px"
        :inline="true"
      >
        <el-form-item label="MIS采购编码" prop="purchaseDocumentCode">
          <!-- <el-input
            v-model="form.purchaseDocumentCode"
            placeholder="请输入MIS采购编码"
          /> -->
          <el-select
            v-model="form.purchaseDocumentCode"
            placeholder="MIS采购编码"
            clearable
            filterable
          >
            <el-option
              v-for="dict in purchaseDocumentCodeList"
              :key="dict"
              :label="dict"
              :value="dict"
            />
          </el-select>
          <el-button type="primary" plain size="mini" @click="opentagkey"
            >+</el-button
          >
        </el-form-item>
        <el-form-item label="采购单号" prop="purchaseOrderNumber">
          <!-- <el-input
            v-model="form.purchaseOrderNumber"
            placeholder="请输入采购单号"
          /> -->
          <el-select
            v-model="form.purchaseOrderNumber"
            placeholder="请输入采购单号"
            clearable
            filterable
          >
            <el-option
              v-for="dict in purchaseOrderNumberList"
              :key="dict"
              :label="dict"
              :value="dict"
            />
          </el-select>
          <el-button type="primary" plain size="mini" @click="opentrigger"
            >+</el-button
          >
        </el-form-item>
        <!-- <el-form-item label="合同号" prop="contractNumber">
          <el-input v-model="form.contractNumber" placeholder="请输入合同号" />
        </el-form-item>
        <el-form-item label="数据异常" prop="dataAnomaly">
          <el-input v-model="form.dataAnomaly" placeholder="请输入数据异常" />
        </el-form-item>
        <el-form-item label="采购日期" prop="purchaseDate">
          <el-date-picker
            clearable
            v-model="form.purchaseDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择采购日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="品牌" prop="brand">
          <el-input v-model="form.brand" placeholder="请输入品牌" />
        </el-form-item>
        <el-form-item label="渠道" prop="channel">
          <el-input v-model="form.channel" placeholder="请输入渠道" />
        </el-form-item>
        <el-form-item label="店铺" prop="storeName">
          <el-input v-model="form.storeName" placeholder="请输入店铺" />
        </el-form-item>
        <el-form-item label="款式数量" prop="styleCount">
          <el-input v-model="form.styleCount" placeholder="请输入款式数量" />
        </el-form-item>
        <el-form-item label="skc数量" prop="skcCount">
          <el-input v-model="form.skcCount" placeholder="请输入skc数量" />
        </el-form-item>
        <el-form-item label="sku数量" prop="skuCount">
          <el-input v-model="form.skuCount" placeholder="请输入sku数量" />
        </el-form-item>
        <el-form-item label="采购金额" prop="purchaseAmount">
          <el-input
            v-model="form.purchaseAmount"
            placeholder="请输入采购金额"
          />
        </el-form-item>
        <el-form-item label="分货状态" prop="货分状态">
          <el-input v-model="form.货分状态" placeholder="请输入分货状态" />
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog
      :visible.sync="openInfo"
      width="1800px"
      append-to-body
      v-if="openInfo"
    >
      <div class="el-dialog-div">
        <component
          :is="'secondary'"
          :purchaseDocumentCode="purchaseDocumentCode"
          @selectpurchaseDocumentCode="selectpurchaseDocumentCode"
        ></component>
      </div>
    </el-dialog>

    <el-dialog
      :visible.sync="opensecondaryindex"
      width="1800px"
      append-to-body
      v-if="opensecondaryindex"
    >
      <div class="el-dialog-div">
        <component
          :is="'secondaryindex'"
          :purchaseDocumentCode="purchaseDocumentCode"
        />
      </div>
    </el-dialog>

    <el-dialog
      :visible.sync="openOrderNumber"
      width="1800px"
      append-to-body
      v-if="openOrderNumber"
    >
      <div class="el-dialog-div">
        <component
          :is="'triggerindex'"
          :purchaseOrderNumber="purchaseOrderNumber"
        />
      </div>
    </el-dialog>

    <el-dialog
      :visible.sync="openrow"
      width="1800px"
      append-to-body
      v-if="openrow"
    >
      <div class="el-dialog-div">
        <component :is="'secondaryindex'" :row="row" />
      </div>
    </el-dialog>

    <el-dialog
      :visible.sync="tagkeyVisible"
      width="1800px"
      append-to-body
      v-if="tagkeyVisible"
    >
      <div class="el-dialog-div">
        <component
          :is="'trigger'"
          :purchaseOrderNumber="purchaseOrderNumber"
          @checkpurchaseOrderNumber="checkpurchaseOrderNumber"
          :showBtn="true"
        ></component>
      </div>
    </el-dialog>
    <el-dialog
      title="以下SKU存在采购单号和渠道提报数量不匹配的情况"
      :visible.sync="openMatch"
      append-to-body
      v-if="openMatch"
    >
      <el-table :data="tableData" style="width: 100%">
        <el-table-column
          prop="purchaseDocumentCode"
          label="采购单据编码"
          width="180"
        ></el-table-column>
        <el-table-column
          prop="purchaseOrderNumber"
          label="采购单号"
          width="180"
        ></el-table-column>
        <el-table-column prop="sku" label="SKU编号" width="180">
          <template slot-scope="scope">
            <span
              style="
                color: rgb(37, 137, 255);
                cursor: pointer;
                text-decoration: underline;
                font-weight: bold;
              "
              @click="handlesecondary(scope.row)"
            >
              {{ scope.row.sku }}
            </span>
          </template>
        </el-table-column>
        <el-table-column
          prop="triggerQty"
          label="采购单中的数量"
          width="180"
        ></el-table-column>
        <el-table-column
          prop="submissionQty"
          label="渠道提报中的数量"
          width="180"
        ></el-table-column>
      </el-table>
      <pagination
        v-show="totalCount > 0"
        :total="totalCount"
        :page.sync="query.currentPage"
        :limit.sync="query.pageSize"
        @pagination="selectgetMatchInfo"
      />
    </el-dialog>

    <el-dialog :visible.sync="openWarehouse" width="1800px">
      <BiStoreWarehouseBinding />
    </el-dialog>
  </div>
</template>

<script>
import {
  listPoRelation,
  getPoRelation,
  delPoRelation,
  addPoRelation,
  updatePoRelation,
  getDistinctPurchaseOrderNumbers,
  checkMatch,
  getMatchInfo,
  syncChannelSubmissionData,
  checkChannelOrderWareHouseBinding,
} from "@/api/productAllocation/poRelation";
import {
  selectAllOrderNumber,
  selectOrderNumber,
} from "@/api/productAllocation/secondary";
import secondary from "@/views/productAllocation/secondary/secondary.vue";
import secondaryindex from "@/views/productAllocation/secondary/index.vue";
import trigger from "@/views/productAllocation/trigger/trigger.vue";
import triggerindex from "@/views/productAllocation/trigger/index.vue";
import BiStoreWarehouseBinding from "@/views/conf/BiStoreWarehouseBinding/index.vue";
export default {
  name: "PoRelation",

  dicts: ["sys_match_status", "sys_warehouse_pass"],
  components: {
    secondaryindex,
    secondary,
    trigger,
    triggerindex,
    BiStoreWarehouseBinding,
  },
  data() {
    return {
      totalCount: 0,
      Params: {},
      query: {
        currentPage: 1,
        pageSize: 10,
      },
      openWarehouse: false,
      openOrderNumber: false,
      tableData: [],
      openMatch: false,
      openrow: false,
      row: {},
      opensecondaryindex: false,
      purchaseOrderNumber: 0,
      tagkeyVisible: false,

      purchaseDocumentCode: 0,
      openInfo: false,
      purchaseOrderNumberList: [],
      purchaseDocumentCodeList: [],
      isOpen: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 渠道提报和采购单关系表格数据
      poRelationList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        purchaseDocumentCode: null,
        purchaseOrderNumber: null,
        contractNumber: null,
        dataAnomaly: null,
        purchaseDate: null,
        brand: null,
        channel: null,
        storeName: null,
        styleCount: null,
        skcCount: null,
        skuCount: null,
        purchaseAmount: null,
        shippedStatus: null,
        货分状态: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
    };
  },
  created() {
    this.getList();

    getDistinctPurchaseOrderNumbers().then((response) => {
      this.purchaseOrderNumberList = response.data;
    });
  },
  // computed: {
  //   // ...mapGetters(["userId"]),
  //   currentComponent() {
  //     let type = parseInt(this.panelType);
  //     switch (type) {
  //       case 5:
  //         return "BiVueAdditionInfo";
  //       case 10:
  //         return "BiVuePropertyInfo";
  //     }
  //   },
  methods: {
    handlewarehouseConfigured(row) {
      if (row.warehouseConfigured == "PASS") {
        return;
      }
      this.openWarehouse = true;
    },
    handleMatchInfo(row) {
      if (row.matchStatus == "MATCHED") {
        return;
      }

      let data = [row.id];
      this.Params = {
        data: data,
        query: { ...this.query },
      };
      getMatchInfo(this.Params).then((response) => {
        this.tableData = response.data.data;
        this.totalCount = response.data.totalCount;
        this.openMatch = true;
      });
      // this.row = row
    },
    selectgetMatchInfo() {
      this.Params.query = { ...this.query };
      getMatchInfo(this.Params).then((response) => {
        this.tableData = response.data.data;
        this.totalCount = response.data.totalCount;
        // this.openMatch = true;
      });
    },
    handlecheckChannelOrderWareHouseBinding() {
      if (this.ids.length < 1) {
        this.$modal.msgError("至少选择一条数据");
        return;
      }
      checkChannelOrderWareHouseBinding(this.ids).then((response) => {
        if (response.code == 200) {
          this.$modal.msgSuccess("检测完毕");
          this.getList();
        }
      });
    },
    handlecheckMatch() {
      if (this.ids.length < 1) {
        this.$modal.msgError("至少选择一条数据");
        return;
      }
      checkMatch(this.ids).then((response) => {
        if (response.code == 200) {
          this.$modal.msgSuccess("检测完毕");
          this.getList();
        }
      });
    },
    handlesyncChannelSubmissionData() {
      if (this.ids.length < 1) {
        this.$modal.msgError("至少选择一条数据");
        return;
      }
      syncChannelSubmissionData(this.ids).then((response) => {
        if (response.code == 200) {
          this.$modal.msgSuccess("同步成功");
          this.getList();
        }
      });
    },
    checkpurchaseOrderNumber(purchaseOrderNumber) {
      this.form.purchaseOrderNumber = purchaseOrderNumber;
      this.tagkeyVisible = false;
    },
    opentrigger() {
      this.purchaseOrderNumber = this.form.purchaseOrderNumber;
      this.tagkeyVisible = true;
    },
    selectpurchaseDocumentCode(Code) {
      this.form.purchaseDocumentCode = Code;
      this.openInfo = false;
    },
    opentagkey() {
      this.purchaseDocumentCode = this.form.purchaseDocumentCode;
      this.openInfo = true;
    },
    selectformisNew(row) {
      this.purchaseDocumentCode = row.purchaseDocumentCode;

      this.opensecondaryindex = true;
    },
    selectpurchaseOrderNumber(row) {
      this.purchaseOrderNumber = row.purchaseOrderNumber;
      this.openOrderNumber = true;
    },
    handlesecondary(row) {
      this.row = row;
      this.openrow = true;
    },
    //搜索栏展示与收起
    shouqi() {
      // console.log(1);
      this.isOpen = !this.isOpen;
    },
    /** 查询渠道提报和采购单关系列表 */
    getList() {
      this.loading = true;
      listPoRelation(this.queryParams).then((response) => {
        this.poRelationList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        purchaseDocumentCode: null,
        purchaseOrderNumber: null,
        contractNumber: null,
        dataAnomaly: null,
        purchaseDate: null,
        brand: null,
        channel: null,
        storeName: null,
        styleCount: null,
        skcCount: null,
        skuCount: null,
        purchaseAmount: null,
        shippedStatus: null,
        货分状态: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.queryParams.pageSize = 10;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.queryParams = {};
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加渠道提报和采购单关系";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      getPoRelation(id).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "修改渠道提报和采购单关系";
      });
      selectAllOrderNumber().then((response) => {
        this.purchaseDocumentCodeList = response;
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            updatePoRelation(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addPoRelation(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm(
          '是否确认删除渠道提报和采购单关系编号为"' + ids + '"的数据项？'
        )
        .then(function () {
          return delPoRelation(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "productAllocation/poRelation/export",
        {
          ...this.queryParams,
        },
        `poRelation_${new Date().getTime()}.xlsx`
      );
    },
  },
};
</script>
